//
//  YBApiManager+Mine.m
//  ChangChat
//
//  Created by Cocoa on 2019/9/3.
//  Copyright © 2019 yibai. All rights reserved.
//

#import "YBApiManager+Mine.h"

@implementation YBApiManager (Mine)

- (RACSignal *)getMyInfo {
    return [self sendGetRequest:@"user/index" param:nil];
}
- (RACSignal *)logout {
    return [self sendGetRequest:@"user/logout" param:nil];
}
- (RACSignal *)changeMyInfoWithAvatar:(NSString *)avatar username:(NSString *)username nickname:(NSString *)nickname bio:(NSString *)bio gender:(NSString *)gender birthday:(NSString *)birthday region:(NSString *)region {
    NSMutableDictionary *m_param = [NSMutableDictionary dictionary];
    if (avatar.isHaveStr) {
        [m_param setObject:avatar forKey:@"avatar"];
    }
    if (username.isHaveStr) {
        [m_param setObject:username forKey:@"username"];
    }
    if (nickname.isHaveStr) {
        [m_param setObject:nickname forKey:@"nickname"];
    }
    if (bio.isHaveStr) {
        [m_param setObject:bio forKey:@"bio"];
    }
    if (gender.isHaveStr) {
        [m_param setObject:gender forKey:@"gender"];
    }
    if (birthday.isHaveStr) {
        [m_param setObject:birthday forKey:@"birthday"];
    }
    if (region.isHaveStr) {
        [m_param setObject:region forKey:@"region"];
    }
    
    return [self sendGetRequest:@"user/profile" param:m_param];
}
- (RACSignal *)changeAddFriendType:(NSInteger)type {
    NSDictionary *param = @{@"type": @(type)};
    return [self sendGetRequest:@"index/change_add_type" param:param];
}
@end
